home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
016a
/
unique.zip
/
UNIQUE.BAT
Wrap
DOS Batch File
|
1991-10-16
|
763b
|
32 lines
:: unique.btm
:: 1991-07-11
:: Marc Thibault 71441,2226
:: Outputs a unique filename in form MoDaHrNn.Ext
:: Input:
:: %1 may be up to 3 chars used as Extension
:: Usage:
:: The following sets 'var' to a unique filename, in the current
:: directory, with 'ext' as the extension.
:: UNIQUE ext | INPUT %%var
:: -------------------------------------------------------------------------
:: c is 2-digit index, initialized at current minute
:: e is 6-digit current month.day.hour
:: f is constructed file name
setlocal
set c=%@substr[%_time,3,2]
set e=%@substr[%_date,0,2]%@substr[%_date,3,2]%@substr[%_time,0,2]
:loop
set f=%e%%c.%1
set c=%@substr[00%@eval[1+%c],1,-2]
if exist %f goto loop
echo %f
endlocal